#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
English Language Pack
"""

MESSAGES = {
    # Frequency processing related
    'frequency_completed': 'Frequency {frequency} Hz processing completed, data points: {len_splats} ({index}/{total}) [{progress_bar}] {progress_percent:.1f}%, convex hull area: {convex_hull_area:.2e}',
    'frequency_processing': 'Processing frequency {frequency} Hz...',
    'frequency_saved': 'Frequency {frequency} Hz data saved to {filename}',
    'frequency_failed': 'Frequency {frequency} Hz processing failed: {error}',
    
    # Progress related
    'progress_start': 'Starting to process {total} frequency points',
    'progress_complete': 'All frequency processing completed',
    'progress_error': 'Error occurred during processing: {error}',
    
    # File operations related
    'file_created': 'File created: {filename}',
    'file_saved': 'File saved: {filename}',
    'file_error': 'File operation failed: {error}',
    
    # Automation related
    'automation_started': 'SIMION automation task started',
    'automation_completed': 'SIMION automation task completed',
    'automation_failed': 'SIMION automation task failed: {error}',
    'automation_stopped': 'SIMION automation task stopped',
    
    # Server related
    'server_started': 'Python server started',
    'server_stopped': 'Python server stopped',
    'server_error': 'Server error: {error}',
    
    # Common messages
    'success': 'Success',
    'error': 'Error',
    'warning': 'Warning',
    'info': 'Info',
    
    # Workspace related
    'workspace_unavailable_single_thread': 'Workspace management module unavailable, using single-thread mode',
    'workspace_detected': 'Detected existing simion_workspace directory',
    'workspace_path': 'Workspace path: {path}',
    'workspace_legacy': 'This may be a legacy workspace from previous runs, manual cleanup recommended',
    'workspace_auto_cleanup': 'If continuing, system will automatically cleanup old workspace',
    'workspace_contents': 'Workspace contains {count} projects:',
    'workspace_more_items': '  ... {count} more projects',
    'workspace_read_error': 'Cannot read workspace contents: {error}',
    'workspace_not_detected': 'No simion_workspace directory detected, can start normally',
    'workspace_setup_failed': 'Workspace setup failed, falling back to single-thread mode',
    'workspace_multi_task': '✅ Multi-task mode: Using parallel execution, workspace isolated',
    'workspace_single_freq': 'Single frequency task, disabling workspace management for performance',
    'workspace_single_thread': 'Workspace management unavailable, using single-thread mode',
    'workspace_decision': '=== Workspace Management Decision ===',
    'workspace_available': 'Workspace management available: {available} Thread count: {threads} Frequency count: {frequencies}',
    
    # File validation related
    'simion_not_found': 'SIMION executable not found: {path}',
    'iob_not_found': 'IOB file not found: {path}',
    'lua_not_found': 'Lua file not found: {path}',
    'lua_retry': 'Lua file not found, retry {attempt}/{max_retries}: {path}',
    'lua_write_retry': 'Failed to write Lua file, retry {attempt}/{max_retries}: {error}',
    'lua_write_failed': 'Lua file write ultimately failed: {error}',
    'lua_update_failed': 'Failed to update Lua file: {error}',
    
    # Command execution related
    'command_execution_failed': '=== SIMION Command Execution Failed ===',
    'command_details': 'Command: {cmd} Return code: {code} Working directory: {work_dir}',
    'return_code_1': 'Return code 1: General error, possibly parameter error or file issue',
    'return_code_2': 'Return code 2: Shell command misuse',
    'return_code_126': 'Return code 126: Command not executable, possibly permission issue or file corruption',
    'return_code_127': 'Return code 127: Command not found, please check if SIMION path is correct',
    'return_code_128': 'Return code 128: Invalid exit parameter',
    'return_code_signal': 'Return code {code}: Process terminated by signal {signal}',
    'signal_9': '  Signal 9 (SIGKILL): Process forcibly terminated',
    'signal_15': '  Signal 15 (SIGTERM): Process normally terminated',
    'return_code_unknown': 'Return code {code}: Unknown error',
    
    # Error output related
    'error_output_details': '=== Error Output Details ===',
    'error_line': 'Error line {line_num}: {line}',
    'error_more_lines': '... {count} more lines of error information',
    'no_error_output': 'No error output information',
    'stdout_details': '=== Standard Output (may contain error information) ===',
    'output_line': 'Output line {line_num}: {line}',
    'output_more_lines': '... {count} more lines of output information',
    
    # Exception handling related
    'exception_details': 'Exception type: {type} Exception info: {message} Command: {cmd} Working directory: {work_dir}',
    
    # Data parsing related
    'parsing_line': 'Line {line_num}: {line}',
    'parsing_value_error': 'Value conversion error when parsing Splat data: {error}, line: {line}',
    'regex_match_failed': '=== Regex Match Failed ===',
    'splat_line': 'Splat line {line_num}: {line}',
    'regex_pattern': 'Regex pattern: {pattern}',
    'simple_match_success': 'Simple match successful, x value: {value}',
    'simple_match_failed': 'Even simple match failed',
    
    # Data degeneration related
    'data_degenerate_x': 'Data degeneration: All x coordinates are the same ({value}), cannot calculate convex hull',
    'data_degenerate_y': 'Data degeneration: All y coordinates are the same ({value}), cannot calculate convex hull',
    'data_degenerate_points': 'Data degeneration: All points coincide, cannot calculate convex hull',
    'qhull_error': 'QHull degenerate data error, skipping convex hull calculation: {error}',
    'convex_hull_failed': 'Convex hull calculation failed, using simplified version: {error}',
    
    # Frequency processing related
    'frequency_no_data': 'Frequency {frequency} Hz: SIMION command executed successfully, but no valid Splat data parsed',
    'frequency_no_data_reasons': '  This may be because:',
    'frequency_no_data_reason_1': '  1. Particle trajectories did not reach detector',
    'frequency_no_data_reason_2': '  2. Detector position setting inappropriate',
    'frequency_no_data_reason_3': '  3. Insufficient particle energy or trajectory deviation',
    'frequency_no_data_reason_4': '  4. Detection logic issue in Lua script',
    'frequency_no_valid_data': 'No valid particle data detected',
    'frequency_processing_error': 'Error processing frequency {frequency} Hz: {error}',
    
    # File saving related
    'csv_dir_create_failed': 'Cannot create output directory: {path}',
    'csv_dir_not_writable': 'Output directory not writable: {path}',
    'csv_save_failed': 'Failed to save CSV file: {error} Target path: {target} Output directory: {output} Directory exists: {exists} Directory writable: {writable}',
    'splat_data_format_error': 'Splat data format incorrect, setting mass to 0',
    'no_splat_data': 'No splat data provided, setting mass to 0',
    'summary_data_prep_failed': 'Failed to prepare summary data: {error}',
    'summary_save_failed': 'Failed to save summary.csv: {error} Target path: {target} Output directory: {output} Directory exists: {exists} Directory writable: {writable}',
    
    # Thread and task related
    'frequency_list_length': 'Frequency list length: {count}',
    'thread_count': 'Thread count: {count}',
    'task_count_less_cpu': 'Task count({tasks}) ≤ CPU cores({cpu}), using task count as thread count',
    'task_count_more_cpu': 'Task count({tasks}) > CPU cores({cpu}), using CPU core count as thread count',
    'using_single_thread': 'Using single-thread mode',
    
    # Cleanup related
    'cleanup_temp_files': 'Cleaning up temp files: {path}',
    'cleanup_workspace': 'Cleaning up workspace: {path}',
    'cleanup_failed': 'Cleanup failed: {error}',
    
    # Statistics related
    'total_frequencies': 'Total: {count} frequencies',
    'success_count': 'Successfully processed: {count} frequencies',
    'failed_count': 'Failed processing: {count} frequencies',
    'automation_complete': '=== SIMION Automation Complete ===',
    'error_details': '=== Error Details ===',
    
    # Others
    'current_directory': 'Current directory'
}
